import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

import { createHtmlPlugin } from "vite-plugin-html";

// 引入@vitejs/plugin-legacy
import legacy from "@vitejs/plugin-legacy";

import { viteSingleFile } from "vite-plugin-singlefile";

// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  publicPath: "./",
  plugins: [
    vue(),
    //修改index.html标题
    createHtmlPlugin({
      inject: {
        data: {
          title: "软件工作室-前端试题",
        },
      },
    }),
    // legacy({
    //   targets: ["defaults", "not IE 11"],
    // }),
    viteSingleFile(),
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
});
